package com.sanben.project.service.impl;

import com.sanben.project.entity.ProjectBidding;
import com.sanben.project.mapper.ProjectBiddingMapper;
import com.sanben.project.service.IProjectBiddingService;
import com.sanben.project.data.dto.ProjectBiddingDto;
import com.sanben.project.data.vo.ProjectBiddingVo;
import com.sanben.project.data.req.ProjectBiddingReq;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.sanben.common.util.BeanCopyUtils;
import java.util.List;

/**
 * @author cyh
 * @description: 项目竞标表 服务实现类
 * @date: 2020-08-11
 */
@Service
public class ProjectBiddingServiceImpl extends ServiceImpl<ProjectBiddingMapper,ProjectBidding> implements IProjectBiddingService {

    @Override
    public IPage<ProjectBiddingVo> page(ProjectBiddingReq req) {
        Page<ProjectBiddingVo> page = new Page<>(req.getPageNum(), req.getPageSize());
        page.setRecords(this.baseMapper.page(page, req));
        return page;
    }

    @Override
    public List<ProjectBidding> lists() {
        return this.list();
    }

    @Override
    public Boolean save(ProjectBiddingDto dto) {
        return this.save(BeanCopyUtils.copy(dto,ProjectBidding.class));
    }

    @Override
    public Boolean updateById(ProjectBiddingDto dto) {
        return this.updateById(BeanCopyUtils.copy(dto,ProjectBidding.class));
    }


    @Override
    public Boolean deleteLogic(List<Integer> toIntList) {
        return  this.removeByIds(toIntList);
    }

    @Override
    public ProjectBidding detail(Integer id) {
        return this.getById(id);
    }
}
